﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;

/// <summary>
/// Summary description for QLTaiKhoan
/// </summary>
public class QLTaiKhoan
{
    ConnectionProcess data = new ConnectionProcess();
	public QLTaiKhoan()
	{
		//
		// TODO: Add constructor logic here
		//
	}
    public DataTable Load_QLTK()
    {
        return data.Get_data("Load_QLTK");
    }
    public void Add_TK(string tennd,string matkhau,string hoten,string email,string quocgia,DateTime ngaythamgia,string chucnang,string tinhtrang,string baomat)
    {
        SqlParameter p1 = new SqlParameter("@tennd", tennd);
        SqlParameter p2 = new SqlParameter("@matkhau", matkhau);
        SqlParameter p3 = new SqlParameter("@hoten", hoten);
        SqlParameter p4 = new SqlParameter("@email", email);
        SqlParameter p5 = new SqlParameter("@quocgia", quocgia);
        SqlParameter p6 = new SqlParameter("@ngaythamgia", ngaythamgia);
        SqlParameter p7 = new SqlParameter("@chucnang", chucnang);
        SqlParameter p8 = new SqlParameter("@tinhtrang", tinhtrang);
        SqlParameter p9 = new SqlParameter("@baomat", baomat);
        data.thuchienlenh("Add_TK", p1, p2, p3, p4, p5, p6, p7, p8, p9);
    }
    public void Del_TK(string tennd)
    {
        SqlParameter p1 = new SqlParameter("@tennd", tennd);
        data.thuchienlenh("Del_TK", p1);
    }
    public DataTable Load_TKid(string tennd)
    {
        SqlParameter p1 = new SqlParameter("@tennd", tennd);
        return data.Get_data("Load_TKid", p1);
    }
    public DataTable Update_TK(string tennd, string tinhtrang, string baomat,string chucnang)
    {
        SqlParameter p1 = new SqlParameter("@tennd", tennd);
        SqlParameter p2 = new SqlParameter("@tinhtrang", tinhtrang);
        SqlParameter p3 = new SqlParameter("@baomat", baomat);
        SqlParameter p4 = new SqlParameter("@chucnang", chucnang);
        return data.Get_data("Update_TK", p1, p2, p3, p4);
    }
    public DataTable Load_dropTinhTrang()
    {
        return data.Get_data("Load_dropTinhTrang");
    }
    public string Load_KTChucNang(string tennd,string matkhau)
    {
        SqlParameter p1 = new SqlParameter("@tennd", tennd);
        SqlParameter p2 = new SqlParameter("@matkhau", matkhau);
        object kq = data.LayDuLieu("Load_KTChucNang", p1, p2);
        if (kq == null)
            return "";
        else
            return kq.ToString();
    }
}
